import set from '@dfeidao/atom-web/local/set';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
// import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import { IFeidaoAiBrowserComponent } from '@dfeidao/web/interfaces';

import P01 from './P01';
export default async function a000(fd: IFeidaoAiBrowserComponent, args: { old: string, role_name: string, role_type_id: string, icon: string; }, old: string, productid: string) {
	//  调用事件
	fd.data.node.querySelector<HTMLDivElement>('[id="zj3"]').classList.remove('display-n');
	// set_node_cls(node, 'dispaly-n', false);
	set(fd, 'old', old);
	set(fd, 'role_name', args.role_name);

	set(fd, 'productid', productid);
	// console.log(productid)

	const data = await nodejs<{ dataArray: object[], count: number }>('roler/zj-000002/s001', { productid });

	render(fd, data, P01, 'P01', 'inner');
	fd.data.node.querySelector<HTMLInputElement>('[name="role_name"]').value = args.role_name;
	fd.data.node.querySelector<HTMLSelectElement>('[name="role_type_id"]').value = args.role_type_id;
	fd.data.node.querySelector<HTMLInputElement>('[name="icon"]').value = args.icon;
}
